//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CEntityId {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CEntityId(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CEntityId obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CEntityId(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static java.math.BigInteger getMaxEntityId() {
    return nelmiscJNI.CEntityId_MaxEntityId_get();
  }

  public static CEntityId getUnknown() {
    long cPtr = nelmiscJNI.CEntityId_Unknown_get();
    return (cPtr == 0) ? null : new CEntityId(cPtr, false);
  }

  public static void setServiceId(short sid) {
    nelmiscJNI.CEntityId_setServiceId(sid);
  }

  public static CEntityId getNewEntityId(short type) {
    return new CEntityId(nelmiscJNI.CEntityId_getNewEntityId(type), true);
  }

  public CEntityId() {
    this(nelmiscJNI.new_CEntityId__SWIG_0(), true);
  }

  public CEntityId(short type, java.math.BigInteger id, short creator, short dynamic) {
    this(nelmiscJNI.new_CEntityId__SWIG_1(type, id, creator, dynamic), true);
  }

  public CEntityId(short type, java.math.BigInteger id) {
    this(nelmiscJNI.new_CEntityId__SWIG_2(type, id), true);
  }

  public CEntityId(java.math.BigInteger p) {
    this(nelmiscJNI.new_CEntityId__SWIG_3(p), true);
  }

  public CEntityId(CEntityId a) {
    this(nelmiscJNI.new_CEntityId__SWIG_4(CEntityId.getCPtr(a), a), true);
  }

  public CEntityId(IStream is) {
    this(nelmiscJNI.new_CEntityId__SWIG_5(IStream.getCPtr(is), is), true);
  }

  public CEntityId(String str) {
    this(nelmiscJNI.new_CEntityId__SWIG_6(str), true);
  }

  public java.math.BigInteger getRawId() {
    return nelmiscJNI.CEntityId_getRawId(swigCPtr, this);
  }

  public java.math.BigInteger getShortId() {
    return nelmiscJNI.CEntityId_getShortId(swigCPtr, this);
  }

  public void setShortId(java.math.BigInteger shortId) {
    nelmiscJNI.CEntityId_setShortId(swigCPtr, this, shortId);
  }

  public short getDynamicId() {
    return nelmiscJNI.CEntityId_getDynamicId(swigCPtr, this);
  }

  public void setDynamicId(short dynId) {
    nelmiscJNI.CEntityId_setDynamicId(swigCPtr, this, dynId);
  }

  public short getCreatorId() {
    return nelmiscJNI.CEntityId_getCreatorId(swigCPtr, this);
  }

  public void setCreatorId(short creatorId) {
    nelmiscJNI.CEntityId_setCreatorId(swigCPtr, this, creatorId);
  }

  public short getType() {
    return nelmiscJNI.CEntityId_getType(swigCPtr, this);
  }

  public void setType(short type) {
    nelmiscJNI.CEntityId_setType(swigCPtr, this, type);
  }

  public java.math.BigInteger getUniqueId() {
    return nelmiscJNI.CEntityId_getUniqueId(swigCPtr, this);
  }

  public boolean isUnknownId() {
    return nelmiscJNI.CEntityId_isUnknownId(swigCPtr, this);
  }

  public boolean isEqual(CEntityId a) {
    return nelmiscJNI.CEntityId_isEqual(swigCPtr, this, CEntityId.getCPtr(a), a);
  }

  public boolean notEqual(CEntityId a) {
    return nelmiscJNI.CEntityId_notEqual(swigCPtr, this, CEntityId.getCPtr(a), a);
  }

  public boolean lt(CEntityId a) {
    return nelmiscJNI.CEntityId_lt(swigCPtr, this, CEntityId.getCPtr(a), a);
  }

  public boolean gt(CEntityId a) {
    return nelmiscJNI.CEntityId_gt(swigCPtr, this, CEntityId.getCPtr(a), a);
  }

  public CEntityId assign(CEntityId a) {
    return new CEntityId(nelmiscJNI.CEntityId_assign__SWIG_0(swigCPtr, this, CEntityId.getCPtr(a), a), false);
  }

  public CEntityId assign(java.math.BigInteger p) {
    return new CEntityId(nelmiscJNI.CEntityId_assign__SWIG_1(swigCPtr, this, p), false);
  }

  public java.math.BigInteger asUint64() {
    return nelmiscJNI.CEntityId_asUint64(swigCPtr, this);
  }

  public void save(IStream os) {
    nelmiscJNI.CEntityId_save(swigCPtr, this, IStream.getCPtr(os), os);
  }

  public void load(IStream is) {
    nelmiscJNI.CEntityId_load(swigCPtr, this, IStream.getCPtr(is), is);
  }

  public void serial(IStream f) {
    nelmiscJNI.CEntityId_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public String toString_c() {
    return nelmiscJNI.CEntityId_toString_c(swigCPtr, this);
  }

  public void fromString(String str) {
    nelmiscJNI.CEntityId_fromString(swigCPtr, this, str);
  }

  public void getDebugString(SWIGTYPE_p_std__string str) {
    nelmiscJNI.CEntityId_getDebugString(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(str));
  }

  public final static int DYNAMIC_ID_SIZE = nelmiscJNI.CEntityId_DYNAMIC_ID_SIZE_get();
  public final static int CREATOR_ID_SIZE = nelmiscJNI.CEntityId_CREATOR_ID_SIZE_get();
  public final static int TYPE_SIZE = nelmiscJNI.CEntityId_TYPE_SIZE_get();
  public final static int ID_SIZE = nelmiscJNI.CEntityId_ID_SIZE_get();
  public final static int UNKNOWN_TYPE = nelmiscJNI.CEntityId_UNKNOWN_TYPE_get();

}
